;
(function($) {
	"use strict";
//表单校验
	$(".submit").on("click",function(){
		var jTipc = $("#input-card").siblings('.tip'),
			sCard = $("#input-card").val(),
			sMsgc = "",

			jTipm = $("#input-cash").siblings('.tip'),
			scash = $("#input-cash").val(),
			sMsgm = "";

		if(sCard.length === 0) {
			sMsgc = "充值卡号不能为空";
		} else if(!/^\d{19}$/.test(sCard)) {
			sMsgc = "卡号必须为19位数字";
		} else if(!/^966108263\d{10}$/.test(sCard)) {
			sMsgc = "充值卡号不符合规范";
		}

		jTipc.text(sMsgc);
		if(sMsgc.length) {
			jTipc.css("opacity","1");
			return false;
		} else {
			jTipc.css("opacity","0");
		}

		if(scash.length === 0) {
			sMsgm = "请输入充值金额";
		}  else if(!ECar.reg.isPFloat(scash)) {
			sMsgm = "充值金额不符合规范";
		}

		jTipm.text(sMsgm);
		if(sMsgm.length) {
			jTipm.css("opacity","1");
			return false;
		} else {
			jTipm.css("opacity","0");
		}

	});

	// 充值错误提示
	// ECar.modal.warn({
	// 	title: "通知",
	// 	content: "您输入的卡号不存在！",
	// 	iconType: "error"
	// });
	
	// 充值成功
	// ECar.modal.confirm({
	// 	height: 150,
	// 	title: "通知",
	// 	content: "充值卡号： 1234567890123456789 <br> 充值金额： 2000.00",
	// 	okTxt: "确认",
	// 	iconType: "success",
	// 	cancelTxt: "取消"
	// });

	// 充值失败
	ECar.modal.confirm({
		title: "通知",
		content: "充值失败，交易不成功！",
		okTxt: "重新输入",
		iconType: "error",
		cancelTxt: "取消"
	});
	
})(jQuery);